<!--#include file="../nav/admin_top.php" -->
<style type="text/css">
table.mytable .mylabel{
width:300px;  
}
span.spans{
color:#333333;
margin-left:20px;
}
</style>
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">后台用户管理</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div>
<div class="menuBg">
	<a class="menuAdd" href="{url::build('admin','users_add')}">添加管理员</a> 
  <div style="clear:both"></div>
</div>
<div style="margin:10px auto">
	关键字：<input type="text" maxlength="12" id="keywords" class="searchs" /> 
	<input type="button"  onclick="fnSearchs()" value="查询"  />  	
</div> 
<div id="grids"></div> 
<script type="text/javascript"> 
var url_modify = '/admin/users_modify';
var url_del = '/admin/users_del';
var myid = "{$myid}";
var grids;
$().ready(function(){ 
	o2js.build('o2grid');
	showLoading();
	grids = new o2Grid({
		bind:'grids', 
		url:'/admin/users_list',
		imgpath:'/misc/vendors/o2js/o2grid/image',
		cols:[
			{index:'id',mapping:'a.id', name:'序号', width:30,sortable:false, func:function(val,row_index,column_name,json,R){
				 return  '<span title="ID：'+json.id+'" >'+((R.page - 1)*R.rowNum + (row_index+1))+'</span>';
			}}, 
			{index:'username',mapping:'a.username', name:'登录名', width:110,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'authgroup_name',mapping:'b.id', name:'权限组', width:130 
			},
			{index:'name',mapping:'a.name', name:'显示姓名', width:100 
			},
			{index:'login_count',mapping:'a.login_count', name:'登录次数', width:50
			},
			{index:'login_date',mapping:'a.login_date', name:'最后登录时间', width:150 ,func:function(val,row_index,column_name,json,R){
					if(!val){
						return  '<span class="red">-</span>';
					}else{
						return  val;
					}
				}
			},
			{index:'login_ip',mapping:'a.login_ip', name:'最后登录IP', width:120 
			},
			{index:'state',mapping:'a.state', name:'状态', width:40 ,func:function(val,row_index,column_name,json,R){
					if(val == '2'){
						return  '<span class="red">暂停</span>';
					}else{
						return '<span class="green">正常</span>';
					}
				}
			},
			{index:'id',mapping:'a.id', name:'操作'	, width:120,sortable:false,func:function(val,row_index,column_name,json,R){
					if(val == '1'){
						return '';
					}else if(myid == val){
						return ' <a href="'+url_modify+'?id='+json.id+'" style="color: "  ><img src="/misc/images/edit.gif" />  修改</a> ';
					}else{
						return   ' <a href="'+url_modify+'?id='+json.id+'" style="color: "  ><img src="/misc/images/edit.gif" />  修改</a> ';
					}
				}
			}
		]
	});
	//fnSearchs();	 
	$('#keywords').keypress(function(e){
		if(e.keyCode==13||e.keyCode==10){
			fnSearchs();
		}
	}); 
	fnSearchs();
});  
function fnSearchsAll(){
	grids.setBaseParams({
		keywords:''
	}); 
	grids.load(1); 
}
function fnSearchs(){
	grids.setBaseParams({
		keywords:encodeURIComponent($('#keywords').val())
	}); 
	grids.load(1); 
} 
/* 删除 */
function fnDel(NId){
	fnConfirm({
		str:'确认删除本行数据?',
		func_true:function(){
			$('button').attr('disabled','disabled');
			$.post(
				url_del,
				{
					id:NId
				},
				function(e){
					var ok = errorHandler(e);
					if(ok && ok.success=='1'){
						window.location.reload();
					}
					$('button').attr('disabled','');
				}
			);
		}
	}); 
}
</script>
<!--#include file="../nav/admin_bottom.php" -->